Page({
  data: {
    menuArr: [{
        img: '/images/OwnerUser/1.png',
        text: '预订订单',
        path: "/pages/ShopOwnerPages/bookOrders/bookOrders"
      },
      {
        img: '/images/OwnerUser/2.png',
        text: '兑换订单',
        path: '/pages/ShopOwnerPages/ExchangeOrders/ExchangeOrders'
      },
      {
        img: '/images/OwnerUser/3.png',
        text: '预约订单',
        path: '/pages/ShopOwnerPages/AppointOrders/AppointOrders'
      },
      {
        img: '/images/OwnerUser/4.png',
        text: '我的服务',
        path: "/pages/ShopOwnerPages/myService/myService",
      },
      {
        img: '/images/OwnerUser/5.png',
        text: '服务会员',
        path: '/pages/ShopOwnerPages/memberList/memberList'
      },
      {
        img: '/images/OwnerUser/6.png',
        text: '修改资料',
        path: '/pages/ShopOwnerPages/editInfo/editInfo'
      },
      {
        img: '/images/OwnerUser/7.png',
        text: '数据统计',
        path: '/pages/ShopOwnerPages/statistics/statistics'
      },
      {
        img: '/images/OwnerUser/8.png',
        text: '财务结算',
        path: '/pages/ShopOwnerPages/settlement/settlement'
      },
      {
        img: '/images/OwnerUser/9.png',
        text: '关于我们',
        path: '/pages/userpages/aboutus/aboutus'
      },
      {
        img: '/images/OwnerUser/10.png',
        text: '联系客服',
        path: '/pages/userpages/customer/customer'
      },
      {
        img: '/images/OwnerUser/11.png',
        text: '用户中心',
        path: '/pages/user/user'
      },
    ]
  },
  getQR() {
    //扫一扫会员信息
    console.log('扫一扫')
    wx.scanCode({
      onlyFromCamera: true,
      success: (res) => {
        console.log(res)
      },
      fail: (res) => {
        wx.showToast({
          title: '扫描失败',
          icon: 'none'
        })
      }
    })
  },

  menuNav(e) {
    //菜单跳转
    // console.log(e.currentTarget.dataset.path);
    let path = e.currentTarget.dataset.path;
    if (path == '/pages/user/user') {
      wx.showModal({
        title: '提示',
        content: '是否切换到用户端',
        cancelColor: '#BDBABE',
        confirmColor: "#FF325B",
        cancelText: '取消',
        confirmText: '确认',
        success: (res) => {
          if (res.confirm) {
            wx.reLaunch({
              url: path,
            })
          }
        }
      })
    } else {
      wx.navigateTo({
        url: path,
      })
    }
  },
  getHoverHeight() {
    //重新计算自定义导航栏的高度
    let menuButtonObject = wx.getMenuButtonBoundingClientRect();
    wx.getSystemInfo({
      success: res => {
        console.log(res)
        let statusBarHeight = res.statusBarHeight,
          navTop = menuButtonObject.top, //胶囊按钮与顶部的距离
          navHeight = statusBarHeight + menuButtonObject.height + (menuButtonObject.top - statusBarHeight) * 2; //导航高度
        getApp().globalData.navHeight = navHeight;
        getApp().globalData.navTop = navTop;
        getApp().globalData.windowHeight = res.windowHeight;
        getApp().globalData.windowHeightNotab = res.windowHeight;
        getApp().globalData.hoverHeight = res.windowHeight - navHeight;
        this.setData({
          safeHeight: res.safeArea.height,
          hoverHeight: res.windowHeight - navHeight,
          navHeight: navHeight
        })
      },
      fail(err) {
        console.log(err);
      }
    })
  },

  onLoad: function (options) {
    this.getHoverHeight()
    // console.log(this.data.hoverHeight, this.data.navHeight)
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    wx.getStorage({
      key: 'OwnerInfo',
      success: (res) => {
        this.setData({
          onwerInfo: res.data
        })
      }
    })
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})